<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="/WEB-INF/common/taglibs.jsp" %>
<div class="main-content">
    <div class="main-content-inner">
        <%@include file="/WEB-INF/common/back/breadcrumb.jsp" %>
        <div class="page-content">
            <form id="addForm" class="form-horizontal" role="form">
                <input type="hidden" name="id" value="${obj.id}">
                <div class="form-group">
                    <label class="col-xs-3 control-label no-padding-right">
                        用户名
                        <span style="color: red;">*</span>
                    </label>
                    <div class="col-xs-9">
                        <input type="text" name="username" value="${obj.username}" class="col-xs-10 col-sm-5">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-3 control-label no-padding-right">
                        手机号
                    </label>
                    <div class="col-xs-9">
                        <input type="text" name="phone" value="${obj.phone}" class="col-xs-10 col-sm-5">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-3 control-label no-padding-right">
                        姓名
                    </label>
                    <div class="col-xs-9">
                        <input type="text" name="name" value="${obj.name}" class="col-xs-10 col-sm-5">
                    </div>
                </div>
                <div class="space-4"></div>
                <div class="clearfix form-actions">
                    <div class="col-md-offset-3 col-md-9">
                        <button class="btn btn-info" type="button" onclick="saveForm()">
                            <i class="ace-icon fa fa-check bigger-110"></i>
                            保存
                        </button>
                        <button type="button" class="btn btn-grey" onclick="history.back()">
                            <i class="ace-icon fa fa-arrow-left bigger-110"></i>
                            返回
                        </button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
<script>
    function saveForm() {
        $.ajax({
            type: "POST",
            url: "${contextPath}/sys/user/save",
            data: {o: 'Auto', params: JSON.stringify($("#addForm").serializeObject())},
            async: false,
            success: function (data) {
                if (data.success) {
                    window.location.href = "${contextPath}/sys/user/home";
                }
                else {
                    layer.msg(data.msg);
                }
            }
        });
    }
</script>
